package com.epam.cdp.selenium2.core.runner.cli;

import java.util.ArrayList;

import org.kohsuke.args4j.Option;

import com.epam.cdp.selenium2.core.configuration.SeleniumInstanceConfiguration;
import com.epam.cdp.selenium2.core.ui.WebDriverType;

/**
 * Parser for CLI parameters.
 * 
 * @author yyudzitski
 */
public class CliParser
{
  @Option( name = "-sh", aliases = {"--selenium-host"}, usage = "Set SeleniumRC host. Default is 'localhost'." )
  public String seleniumHostName = "localhost";

  @Option( name = "-sp", aliases = {"--selenium-port"}, usage = "Set SeleniumRC port. Default is '4444'." )
  public String seleniumHostPort = "4444";

  @Option( name = "-shl", aliases = {"--selenium-login"}, usage = "Set SeleniumRC host login. No default value." )
  public String seleniumHostLogin = "";

  @Option( name = "-shp", aliases = {"--selenium-pass"}, usage = "Set SeleniumRC host password. No default value." )
  public String seleniumHostPassword = "";

  @Option( name = "-dt", aliases = {"--driver-type"}, usage = "Type of driver. Default is 'firefox'." )
  public WebDriverType driverType = WebDriverType.FIREFOX;

  @Option( name = "-tng", aliases = {"--testng"}, usage = "Suite to run. Default is 'testng.xml'.", multiValued = true )
  public ArrayList<String> xmlSuite = new ArrayList<String>()
  {
    private static final long serialVersionUID = 6178602887071770944L;

    {
      add( "testng.xml" );
    }
  };

  @Option( name = "-of", aliases = {"--options"}, usage = "User options file. Default is 'options.xml'" )
  public String optionsFile = "options.xml";

  @Option( name = "-sc", aliases = {"--selenium-config"}, usage = "Selenium server configuration. Default is localhost:4444", handler = SeleniumConfigCliHandler.class, multiValued = true )
  public ArrayList<SeleniumInstanceConfiguration> configs = new ArrayList<SeleniumInstanceConfiguration>();

  @Option( name = "-ru", aliases = {"--root-url"}, usage = "Base URL to be oppened. Default is 'http://google.ru'" )
  public String rootUrl = "http://google.ru";
}